import { createRouter, createWebHashHistory } from 'vue-router';

// 静态路由
export const routes = [
  {
    path: '/index',
    meta: {
      title: '首页'
    },
    component: () => import('@/views/index/index.vue')
  },
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/login',
    name: 'login',
    meta: {
      title: '登录'
    },
    component: () => import('@/views/login/login.vue')
  },
  {
    path: '/register',
    name: 'register',
    meta: {
      title: '注册'
    },
    component: () => import('@/views/login/register.vue')
  },
  {
    path: '/nonetwork',
    meta: {
      title: '网络错误'
    },
    component: () => import('@/views/errorPage/nonetwork.vue')
  },
  {
    path: '/404',
    meta: {
      title: '404'
    },
    component: () => import('@/views/errorPage/404.vue')
  }
];

// 创建路由
const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
